<?php

namespace app\logic\model\order;

use app\logic\model\LogicModel;
use app\logic\single\GoodsSingle;

class OrderMusicDetailLogicModel extends LogicModel
{

    protected $name='order_music_detail';

    static function getByOrderId($order_id= 0,$field='*',$selectGoods = true){
        $list = self::where('order_id',$order_id)
            ->field($field)
            ->select()->toArray();
        if($selectGoods){
            foreach ($list as &$val){
                $val['goods'] = GoodsSingle::getInstance()->getGoodsByType($val['goods_id'],$val['type']);
            }
            unset($val);
        }
        return $list;
    }
}